package com.daocao.jy.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.text.Spanned;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.daocao.jy.R;
import com.daocao.jy.util.Spans;

import butterknife.BindView;
import butterknife.ButterKnife;


/**
 * Created by xsooy-pc on 2017/10/23.
 */

public class AgencyRecordAdapter extends ItemAdapter<String, AgencyRecordAdapter.DefaultHolder> {


    private final int textSize26;


    private Context context;

    public AgencyRecordAdapter(Context context) {
        super(context);
        textSize26 = context.getResources().getDimensionPixelSize(R.dimen.x26);
        this.context = context;
    }

    @Override
    public DefaultHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new DefaultHolder(inflate(R.layout.item_agency_record, parent));
    }

    @Override
    public void onBindViewHolder(DefaultHolder holder, int position) {
        Spanned textTwo = Spans.with(context).font("代办人手机号：17688985250\n", textSize26, 0xff333333).
                font("代办人姓名：张德财\n", textSize26, 0xff333333).
                font("收卡地址：广东省东莞市南城区胜和联益二村大地塘8号之一", textSize26, 0xff333333).
                build();
        holder.txtInfo.setText(textTwo);
    }

    class DefaultHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.txt_status)
        TextView txtStatus;
        @BindView(R.id.txt_info)
        TextView txtInfo;

        public DefaultHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
